package com.woogiemobile.pojo;

import com.woogiemobile.MainService;
import com.woogiemobile.async.UploadContactsAndMessages;

public class Register{
	private String number;
	private String email;
	private String password;
	private String display;
	
	private static Register Instance;
	
	private Register(String number, String email, String password, String display){
		this.number = number;
		this.email = email; 
		this.password = password;
		this.display = display;
	}
	
	public String toString() {
		return "Register:~>;+15149670418:~;;austintakam@gmail.com:~;;s3cr3t:~;;Austin";
	}
	
	public static Register getRegister(String number, String email, String password, String display){
		if (Instance == null)
		{
			Instance = new Register(number, email, password, display);
		}
		else {
			Register r = new Register(number, email, password, display);
			//if (!r.equals(Instance)){
				Instance = r;
			//}
		}
		return Instance;
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof Register))
			return false;
		Register copy = (Register) o;
		if (copy.display.equalsIgnoreCase(display)
				&& copy.email.equalsIgnoreCase(email)
				&& copy.number.equalsIgnoreCase(number)
				&& copy.password.equalsIgnoreCase(password))
			return true;
		return false;
	}
	
	public static void save(){
		new UploadContactsAndMessages(MainService.service).execute();
	}
}
